package ioc06;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Author：汤小洋
 * Date：2023-12-13 16:08
 * Description：<描述>
 */
public class MyUtil {

    public static void print(){
        /**
         * 此处不能再重新建IoC容器，否则会有多个Spring容器
         */
        // ApplicationContext ac = new ClassPathXmlApplicationContext("ioc06/spring.xml");

        SpringBean springBean = ApplicationContextHolder.getBean(SpringBean.class);
        System.out.println(springBean.getName());
    }

}
 